/**
 *
 */
import Util;
import OpenApi;

import EndpointUtil;

extends OpenApi;

init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('lx', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }

  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}
model ModifyReservedInstanceRequest {
  paramStr?: string(name='paramStr'),
}

model ModifyReservedInstanceResponseBody = {
  data?: string(name='Data'),
  requestId?: string(name='RequestId'),
  errCode?: string(name='ErrCode'),
  success?: boolean(name='Success'),
  code?: string(name='Code'),
  message?: string(name='Message'),
}

model ModifyReservedInstanceResponse = {
  headers: map[string]string(name='headers'),
  body: ModifyReservedInstanceResponseBody(name='body'),
}

async function modifyReservedInstanceWithOptions(request: ModifyReservedInstanceRequest, runtime: Util.RuntimeOptions): ModifyReservedInstanceResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('ModifyReservedInstance', '2015-07-01', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function modifyReservedInstance(request: ModifyReservedInstanceRequest): ModifyReservedInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyReservedInstanceWithOptions(request, runtime);
}

model PageQueryByPipCodeRequest {
  pipCode?: string(name='PipCode'),
  page?: int32(name='Page'),
}

model PageQueryByPipCodeResponseBody = {
  data?: string(name='Data'),
  requestId?: string(name='RequestId'),
  remark?: string(name='Remark'),
  code?: string(name='Code'),
  totalPage?: int32(name='TotalPage'),
  pageSize?: int32(name='PageSize'),
  totalCount?: int32(name='TotalCount'),
}

model PageQueryByPipCodeResponse = {
  headers: map[string]string(name='headers'),
  body: PageQueryByPipCodeResponseBody(name='body'),
}

async function pageQueryByPipCodeWithOptions(request: PageQueryByPipCodeRequest, runtime: Util.RuntimeOptions): PageQueryByPipCodeResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('PageQueryByPipCode', '2015-07-01', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function pageQueryByPipCode(request: PageQueryByPipCodeRequest): PageQueryByPipCodeResponse {
  var runtime = new Util.RuntimeOptions{};
  return pageQueryByPipCodeWithOptions(request, runtime);
}

model RefundVnoBatchInstancesRequest {
  requestId?: string(name='RequestId'),
  paramStr?: string(name='ParamStr'),
  componentsStr?: string(name='ComponentsStr'),
  callerBid?: string(name='CallerBid'),
  callerUid?: long(name='CallerUid'),
}

model RefundVnoBatchInstancesResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  data?: string(name='Data'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model RefundVnoBatchInstancesResponse = {
  headers: map[string]string(name='headers'),
  body: RefundVnoBatchInstancesResponseBody(name='body'),
}

async function refundVnoBatchInstancesWithOptions(request: RefundVnoBatchInstancesRequest, runtime: Util.RuntimeOptions): RefundVnoBatchInstancesResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('RefundVnoBatchInstances', '2015-07-01', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function refundVnoBatchInstances(request: RefundVnoBatchInstancesRequest): RefundVnoBatchInstancesResponse {
  var runtime = new Util.RuntimeOptions{};
  return refundVnoBatchInstancesWithOptions(request, runtime);
}

model DescribeReservedInstancePriceRequest {
  paramStr?: string(name='paramStr'),
}

model DescribeReservedInstancePriceResponseBody = {
  data?: string(name='Data'),
  requestId?: string(name='RequestId'),
  errCode?: string(name='ErrCode'),
  success?: boolean(name='Success'),
  code?: string(name='Code'),
  message?: string(name='Message'),
}

model DescribeReservedInstancePriceResponse = {
  headers: map[string]string(name='headers'),
  body: DescribeReservedInstancePriceResponseBody(name='body'),
}

async function describeReservedInstancePriceWithOptions(request: DescribeReservedInstancePriceRequest, runtime: Util.RuntimeOptions): DescribeReservedInstancePriceResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('DescribeReservedInstancePrice', '2015-07-01', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function describeReservedInstancePrice(request: DescribeReservedInstancePriceRequest): DescribeReservedInstancePriceResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeReservedInstancePriceWithOptions(request, runtime);
}

model ValidateCreateOrderExpressRequest {
  paramStr?: string(name='ParamStr'),
}

model ValidateCreateOrderExpressResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  data?: boolean(name='Data'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ValidateCreateOrderExpressResponse = {
  headers: map[string]string(name='headers'),
  body: ValidateCreateOrderExpressResponseBody(name='body'),
}

async function validateCreateOrderExpressWithOptions(request: ValidateCreateOrderExpressRequest, runtime: Util.RuntimeOptions): ValidateCreateOrderExpressResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('ValidateCreateOrderExpress', '2015-07-01', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function validateCreateOrderExpress(request: ValidateCreateOrderExpressRequest): ValidateCreateOrderExpressResponse {
  var runtime = new Util.RuntimeOptions{};
  return validateCreateOrderExpressWithOptions(request, runtime);
}

model FillAgAccountActionRequest {
  invoker?: string(name='Invoker'),
  mpk?: string(name='Mpk'),
  pk?: string(name='Pk'),
  type?: string(name='Type'),
}

model FillAgAccountActionResponseBody = {
  type?: string(name='Type'),
  requestId?: string(name='RequestId'),
  invoker?: string(name='Invoker'),
  pk?: string(name='Pk'),
  mpk?: string(name='Mpk'),
  success?: boolean(name='Success'),
}

model FillAgAccountActionResponse = {
  headers: map[string]string(name='headers'),
  body: FillAgAccountActionResponseBody(name='body'),
}

async function fillAgAccountActionWithOptions(request: FillAgAccountActionRequest, runtime: Util.RuntimeOptions): FillAgAccountActionResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('FillAgAccountAction', '2015-07-01', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function fillAgAccountAction(request: FillAgAccountActionRequest): FillAgAccountActionResponse {
  var runtime = new Util.RuntimeOptions{};
  return fillAgAccountActionWithOptions(request, runtime);
}

model ValidateUserBuyPermissionRequest {
  orderType?: string(name='OrderType'),
  fromApp?: string(name='FromApp'),
  buyerAliUid?: long(name='BuyerAliUid'),
  commodityInfo?: [ 
    {
      specCode?: string(name='SpecCode'),
      articleCode?: string(name='ArticleCode'),
      commodityExtParams?: map[string]any(name='CommodityExtParams'),
      regionId?: string(name='RegionId'),
    }
  ](name='CommodityInfo'),
}

model ValidateUserBuyPermissionResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  data?: boolean(name='Data'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ValidateUserBuyPermissionResponse = {
  headers: map[string]string(name='headers'),
  body: ValidateUserBuyPermissionResponseBody(name='body'),
}

async function validateUserBuyPermissionWithOptions(request: ValidateUserBuyPermissionRequest, runtime: Util.RuntimeOptions): ValidateUserBuyPermissionResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('ValidateUserBuyPermission', '2015-07-01', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function validateUserBuyPermission(request: ValidateUserBuyPermissionRequest): ValidateUserBuyPermissionResponse {
  var runtime = new Util.RuntimeOptions{};
  return validateUserBuyPermissionWithOptions(request, runtime);
}

model SubscriptionCreateOrderApiRequest {
  ownerId?: string(name='ownerId'),
  productCode?: string(name='productCode'),
}

model SubscriptionCreateOrderApiResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  data?: string(name='Data'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model SubscriptionCreateOrderApiResponse = {
  headers: map[string]string(name='headers'),
  body: SubscriptionCreateOrderApiResponseBody(name='body'),
}

async function subscriptionCreateOrderApiWithOptions(request: SubscriptionCreateOrderApiRequest, runtime: Util.RuntimeOptions): SubscriptionCreateOrderApiResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('SubscriptionCreateOrderApi', '2015-07-01', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function subscriptionCreateOrderApi(request: SubscriptionCreateOrderApiRequest): SubscriptionCreateOrderApiResponse {
  var runtime = new Util.RuntimeOptions{};
  return subscriptionCreateOrderApiWithOptions(request, runtime);
}

model TransferResourceRequest {
  fromApp?: string(name='FromApp'),
  token?: string(name='Token'),
  needCallback?: boolean(name='NeedCallback'),
  instanceId?: string(name='InstanceId'),
  commodityCode?: string(name='CommodityCode'),
  specCode?: string(name='SpecCode'),
  currentOwnerId?: long(name='CurrentOwnerId'),
  currentBuyerId?: long(name='CurrentBuyerId'),
  transferTargetBuyerId?: long(name='TransferTargetBuyerId'),
  transferTargetOwnerId?: long(name='TransferTargetOwnerId'),
}

model TransferResourceResponseBody = {
  requestId?: string(name='RequestId'),
  errCode?: string(name='ErrCode'),
  success?: boolean(name='Success'),
  code?: string(name='Code'),
  message?: string(name='Message'),
  tokenConflicted?: boolean(name='TokenConflicted'),
  data?: {
    refundOrderId?: long(name='RefundOrderId'),
    buyOrderId?: long(name='BuyOrderId'),
  }(name='Data'),
}

model TransferResourceResponse = {
  headers: map[string]string(name='headers'),
  body: TransferResourceResponseBody(name='body'),
}

async function transferResourceWithOptions(request: TransferResourceRequest, runtime: Util.RuntimeOptions): TransferResourceResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('TransferResource', '2015-07-01', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function transferResource(request: TransferResourceRequest): TransferResourceResponse {
  var runtime = new Util.RuntimeOptions{};
  return transferResourceWithOptions(request, runtime);
}

model DoPhysicalDeleteResourceRequest {
  pk?: string(name='Pk'),
  bid?: string(name='Bid'),
  hid?: long(name='Hid'),
  country?: string(name='Country'),
  taskIdentifier?: string(name='TaskIdentifier'),
  taskExtraData?: string(name='TaskExtraData'),
  gmtWakeup?: string(name='GmtWakeup'),
}

model DoPhysicalDeleteResourceResponseBody = {
  pk?: string(name='Pk'),
  invoker?: string(name='Invoker'),
  gmtWakeup?: string(name='GmtWakeup'),
  hid?: long(name='Hid'),
  success?: boolean(name='Success'),
  country?: string(name='Country'),
  message?: boolean(name='Message'),
  interrupt?: boolean(name='Interrupt'),
  taskExtraData?: string(name='TaskExtraData'),
  bid?: string(name='Bid'),
  taskIdentifier?: string(name='TaskIdentifier'),
}

model DoPhysicalDeleteResourceResponse = {
  headers: map[string]string(name='headers'),
  body: DoPhysicalDeleteResourceResponseBody(name='body'),
}

async function doPhysicalDeleteResourceWithOptions(request: DoPhysicalDeleteResourceRequest, runtime: Util.RuntimeOptions): DoPhysicalDeleteResourceResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('doPhysicalDeleteResource', '2015-07-01', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function doPhysicalDeleteResource(request: DoPhysicalDeleteResourceRequest): DoPhysicalDeleteResourceResponse {
  var runtime = new Util.RuntimeOptions{};
  return doPhysicalDeleteResourceWithOptions(request, runtime);
}

